package com.example.my.meila.view.adapter.beautyadapter;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;

import com.example.my.meila.R;
import com.example.my.meila.common.image.ImageLoader;
import com.example.my.meila.constast.Constast;
import com.example.my.meila.entity.MakeUp;

import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * Created by My on 2016/11/1.
 */
public class MakeUpHeadAdapter extends RecyclerView.Adapter<MakeUpHeadAdapter.HeadViewHolder> {


    private Context context;
    private List<MakeUp.DataBean.MakeupButtonsBean> data;

    public MakeUpHeadAdapter(Context context, List<MakeUp.DataBean.MakeupButtonsBean> data) {
        this.context = context;
        this.data = data;
    }

    @Override
    public HeadViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        return new HeadViewHolder(LayoutInflater.from(context).inflate(R.layout.item_good_childiv, null));
    }

    @Override
    public void onBindViewHolder(HeadViewHolder holder, int position) {
        ImageLoader.getInstance().display(context, Constast.PUBLIC_URL+data.get(position).getImg(),holder.itemGoodIv);

    }

    @Override
    public int getItemCount() {
        return data.size();
    }

    class HeadViewHolder extends RecyclerView.ViewHolder {
        @BindView(R.id.item_good_iv)
        ImageView itemGoodIv;
        public HeadViewHolder(View itemView) {
            super(itemView);
            ButterKnife.bind(this,itemView);
        }
    }
}
